Skip to content

Figure.pygmtlogo: Initial version for the circular, colored PyGMT logo#3849

Open
yvonnefroehlich wants to merge 431 commits intopygmtlogofrom
code-pygmt-logo
Open

Figure.pygmtlogo: Initial version for the circular, colored PyGMT logo#3849
yvonnefroehlich wants to merge 431 commits intopygmtlogofrom
code-pygmt-logo

Conversation

@yvonnefroehlich
Copy link
Copy Markdown
Member

@yvonnefroehlich yvonnefroehlich commented Mar 13, 2025

Description of proposed changes

Related to #1404 (comment), create the PyGMT logo in Python with PyGMT:

  • Python script
  • Separate method Figure.pygmtlogo or Figure.logo_pygmt as part of the Figure class or
    addition to the method Figure.logo (which plots the GMT logo)
  • Documentation
  • Tests -> only circular, color, light and dark themes
  • Gallery example -> separate PR

Related to

Preview:
https://pygmt-dev--3849.org.readthedocs.build/en/3849/api/generated/pygmt.Figure.pygmtlogo.html

image image image image
image image image image
image image image image

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash command is:

  • /format: automatically format and lint the code

@yvonnefroehlich yvonnefroehlich added the documentation Improvements or additions to documentation label Mar 13, 2025
@yvonnefroehlich yvonnefroehlich self-assigned this Mar 13, 2025
@yvonnefroehlich yvonnefroehlich changed the title Add first version of PyGMT code for PyGMT logo POC: DOC: Code PyGMT logo in PyGMT and add as gallery example Mar 13, 2025
@yvonnefroehlich
Copy link
Copy Markdown
Member Author

/format

@michaelgrund
Copy link
Copy Markdown
Member

michaelgrund commented Mar 13, 2025

I feel the logo definition should be separated into a standalone method, similar to the method to plot the GMT logo. This would allow to plot the PyGMT logo by calling something like pygmt.Figure.pygmt_logo. The individual formats could be selected by different input parameters like you did or hex = True or darkmode = True.

Comment thread examples/gallery/embellishments/pygmt_logo.py Outdated
Comment thread examples/gallery/embellishments/pygmt_logo.py Outdated
@yvonnefroehlich yvonnefroehlich marked this pull request as draft March 13, 2025 13:27
@yvonnefroehlich yvonnefroehlich changed the title POC: DOC: Code PyGMT logo in PyGMT and add as gallery example POC: DOC: Code PyGMT logo in PyGMT (method Figure.pygmt_logo and gallery example) Mar 13, 2025
@yvonnefroehlich yvonnefroehlich added the feature Brand new feature label Mar 13, 2025
@yvonnefroehlich yvonnefroehlich changed the title POC: DOC: Code PyGMT logo in PyGMT (method Figure.pygmt_logo and gallery example) POC: Code PyGMT logo in PyGMT (method Figure.pygmt_logo and gallery example) Mar 13, 2025
@yvonnefroehlich yvonnefroehlich changed the title POC: Code PyGMT logo in PyGMT (method Figure.pygmt_logo and gallery example) POC: Code PyGMT logo in PyGMT (method or / and gallery example) Mar 13, 2025
@yvonnefroehlich
Copy link
Copy Markdown
Member Author

ruff v0.10.0 was released 2 hours ago causing the newly falling code style checks.

Comment thread examples/gallery/embellishments/pygmt_logo.py Outdated
Comment thread examples/gallery/embellishments/pygmt_logo.py Outdated
@seisman seisman reopened this Mar 13, 2025
@yvonnefroehlich yvonnefroehlich changed the title POC: Code PyGMT logo in PyGMT (method or / and gallery example) POC: Code PyGMT logo in PyGMT Mar 14, 2025
Comment thread examples/gallery/embellishments/pygmt_logo.py Outdated
Comment thread examples/gallery/embellishments/pygmt_logo.py Outdated
Comment thread examples/gallery/embellishments/pygmt_logo.py Outdated
Comment thread examples/gallery/embellishments/pygmt_logo.py Outdated
Comment thread examples/gallery/embellishments/pygmt_logo.py Outdated
Comment thread examples/gallery/embellishments/pygmt_logo.py Outdated
@seisman
Copy link
Copy Markdown
Member

seisman commented Mar 16, 2025

  • separat method Figure.pygmtlogo or Figure.logo_pygmt as part of the Figure class or addition to the method Figure.logo (which plots the GMT logo)

@yvonnefroehlich You can follow the steps below:

  1. Create a pygmtlogo.py file under the pygmt/src/ directory
  2. Move the current pygmtlogo function to this file
  3. Add self as the first parameter of the pygmtlogo function
  4. Change fig.image (line 269) to self.image.
  5. Add from pygmt.src.pygmtlogo import pygmtlogo in pygmt/src/__init__.py
  6. Near line 429 in pygmt/figure.py, add pygmtlogo.

Then, you should be able to call Figure.pygmtlogo to add the logo.

Comment thread pygmt/src/pygmtlogo.py Outdated
Comment thread pygmt/src/pygmtlogo.py Outdated
Comment thread examples/gallery/embellishments/pygmt_logo.py Outdated
Comment thread pygmt/src/pygmtlogo.py Outdated
Comment thread examples/gallery/embellishments/pygmt_logo.py Outdated
Comment thread pygmt/src/pygmtlogo.py Outdated
yvonnefroehlich and others added 2 commits May 1, 2026 08:00
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Comment thread pygmt/tests/baseline/test_pygmtlogo.png.dvc Outdated
Comment thread pygmt/src/pygmtlogo.py Outdated
Comment thread pygmt/src/pygmtlogo.py Outdated
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Comment thread pygmt/src/pygmtlogo.py
Comment on lines +270 to +271
Plot the PyGMT logo.
The design of the logo is kindly provided by `@sfrooti <https://github.com/sfrooti>`_
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Plot the PyGMT logo.
The design of the logo is kindly provided by `@sfrooti <https://github.com/sfrooti>`_
Plot the PyGMT logo.
The design of the logo is kindly provided by `@sfrooti <https://github.com/sfrooti>`_

@seisman seisman changed the base branch from main to pygmtlogo May 2, 2026 03:57
@seisman seisman changed the title Code PyGMT logo in PyGMT Figure.pygmtlogo: Initial version for the circular PyGMT logo May 2, 2026
@seisman seisman changed the title Figure.pygmtlogo: Initial version for the circular PyGMT logo Figure.pygmtlogo: Initial version for the circular, colored PyGMT logo May 2, 2026
@seisman
Copy link
Copy Markdown
Member

seisman commented May 2, 2026

I think the circular, colored version of the PyGMT logo is good enough to be finalized. I've changed the base branch to pygmtlogo and updated the PR title.

OK to merge after addressing comment #3849 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Brand new feature

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants